package l1j.server.server.command.executor;

import l1j.server.server.model.Instance.L1PcInstance;
import l1j.server.server.serverpackets.S_SystemMessage;

public class L1OverHeard implements L1CommandExecutor {
	private L1OverHeard() {
	}

	public static L1CommandExecutor getInstance() {
		return new L1OverHeard();
	}

	@Override
	public void execute(L1PcInstance pc, String cmdName, String arg) {
		try {
			boolean i = false;
			if (arg.equalsIgnoreCase("open"))
				i = true;
			else if (arg.equalsIgnoreCase("close"))
				i = false;
			pc.setOverHeard(i);
			pc.sendPackets(new S_SystemMessage("GM竊聽狀態為："+ arg));
		}
		catch (Exception exception) {
			pc.sendPackets(new S_SystemMessage("請輸入 " + cmdName + "open / close"));
		}
	}
}
